﻿<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        
        // Load the config file 
        // And start the basic error system
        SMBL.Global.WebSite.Boot();
        // Cache the config file and 
        // Start the error system and log system
        SMBL.Core.Kernel.Initialize();
        // Start the file system
        
        // Start the database system
        SMBL.ADBS.ConnectionControl.Initialize();
        // Start the file system
        SMBL.AFS.DocumentPool.Initialize();
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown

        // Terminate the database system
        SMBL.ADBS.ConnectionControl.Terminate();
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started

    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.

    }
    /*protected void Application_AuthenticateRequest(Object sender, EventArgs e)
    {
        HttpApplication app = (HttpApplication)sender;
        HttpContext ctx = app.Context; //获取本次Http请求的HttpContext对象  
        if (ctx.User != null)
        {
            if (ctx.Request.IsAuthenticated == true) //验证过的一般用户才能进行角色验证  
            {
                System.Web.Security.FormsIdentity fi = (System.Web.Security.FormsIdentity)ctx.User.Identity;
                System.Web.Security.FormsAuthenticationTicket ticket = fi.Ticket; //取得身份验证票  
                string userData = ticket.UserData;//从UserData中恢复role信息
                string[] roles = userData.Split(','); //将角色数据转成字符串数组,得到相关的角色信息  
                ctx.User = new System.Security.Principal.GenericPrincipal(fi, roles); //这样当前用户就拥有角色信息了
            }
        }
    }*/
</script>
